﻿#include "InstructionThermostatConnect.h"

#include "ScriptRunner.h"
#include "TurnTableCodec.h"

__SCRIPTINSTRUCTION_REGISTER(InstructionThermostatConnect,ScriptInstruction::Instruction_Thermostat_Connect,&InstructionThermostatConnect::fromByteArray1);

InstructionThermostatConnect::InstructionThermostatConnect()
{
  instructionFlag = Instruction_Thermostat_Connect;
}

InstructionThermostatConnect::InstructionThermostatConnect(InstructionThermostatConnect const& instructionThermostatConnect)
{
  *this=instructionThermostatConnect;
}

InstructionThermostatConnect& InstructionThermostatConnect::operator=(InstructionThermostatConnect const & instructionThermostatConnect)
{
  *(ScriptInstruction*)this=instructionThermostatConnect;
  return *this;
}

InstructionThermostatConnect::~InstructionThermostatConnect()
{}


void InstructionThermostatConnect::run()
{
  scriptRunner->sendInstruction(deviceId,TurnTableCodec::Thermostat_Connect);
  scriptRunner->scriptWaitAndRun(scriptRunner->getInterval_instruction(),deviceId);
}

QString InstructionThermostatConnect::toString()
{
  return QStringLiteral("连接温箱");
}

QByteArray InstructionThermostatConnect::toByteArray()
{
  return ScriptInstruction::toByteArray();
}

ScriptInstruction* InstructionThermostatConnect::fromByteArray1(char * const src,int size,int * offset)
{
  (void)src;
  (void)size;
  (void)offset;
  return new InstructionThermostatConnect();
}
